/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.myapp.struts;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Usuario
 */
@Entity
@Table(name = "HORARIO")
@NamedQueries({@NamedQuery(name = "HorarioPersistente.findByIdHorario", query = "SELECT h FROM HorarioPersistente h WHERE h.idHorario = :idHorario"), @NamedQuery(name = "HorarioPersistente.findByDescHorario", query = "SELECT h FROM HorarioPersistente h WHERE h.descHorario = :descHorario"), @NamedQuery(name = "HorarioPersistente.findByDataHorario", query = "SELECT h FROM HorarioPersistente h WHERE h.dataHorario = :dataHorario"), @NamedQuery(name = "HorarioPersistente.findByRecorrencia", query = "SELECT h FROM HorarioPersistente h WHERE h.recorrencia = :recorrencia")})
public class HorarioPersistente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "ID_HORARIO", nullable = false)
    private Integer idHorario;
    @Column(name = "DESC_HORARIO", nullable = false)
    private String descHorario;
    @Column(name = "DATA_HORARIO", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date dataHorario;
    @Column(name = "RECORRENCIA", nullable = false)
    private int recorrencia;
    @JoinColumn(name = "ID_AGENDA", referencedColumnName = "ID_AGENDA")
    @ManyToOne
    private AgendaPersistente idAgenda;

    public HorarioPersistente() {
    }

    public HorarioPersistente(Integer idHorario) {
        this.idHorario = idHorario;
    }

    public HorarioPersistente(Integer idHorario, String descHorario, Date dataHorario, int recorrencia) {
        this.idHorario = idHorario;
        this.descHorario = descHorario;
        this.dataHorario = dataHorario;
        this.recorrencia = recorrencia;
    }

    public Integer getIdHorario() {
        return idHorario;
    }

    public void setIdHorario(Integer idHorario) {
        this.idHorario = idHorario;
    }

    public String getDescHorario() {
        return descHorario;
    }

    public void setDescHorario(String descHorario) {
        this.descHorario = descHorario;
    }

    public Date getDataHorario() {
        return dataHorario;
    }

    public void setDataHorario(Date dataHorario) {
        this.dataHorario = dataHorario;
    }

    public int getRecorrencia() {
        return recorrencia;
    }

    public void setRecorrencia(int recorrencia) {
        this.recorrencia = recorrencia;
    }

    public AgendaPersistente getIdAgenda() {
        return idAgenda;
    }

    public void setIdAgenda(AgendaPersistente idAgenda) {
        this.idAgenda = idAgenda;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idHorario != null ? idHorario.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HorarioPersistente)) {
            return false;
        }
        HorarioPersistente other = (HorarioPersistente) object;
        if ((this.idHorario == null && other.idHorario != null) || (this.idHorario != null && !this.idHorario.equals(other.idHorario))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.myapp.struts.HorarioPersistente[idHorario=" + idHorario + "]";
    }

}
